// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import {zcServer} from './common/js/zcServer'
import axios from 'axios'
import { store } from './store/store.js';
import {theConfirm,theToast} from './components/cm_confirm2.js'
// import theToast  from './components/cm_confirm2.js'
Vue.prototype.$confirm = theConfirm;
Vue.prototype.$toast = theToast;

import myCharts from './common/js/myCharts'
Vue.use(myCharts)
Vue.config.productionTip = false
Vue.prototype.$ZcPublic = {
  needLogin:false,
  Http: axios,
  Server: "",
  Domain: "",
  zcServer:zcServer,
  OrganCode:"01",
  GB_OrganSN:'237CA873-8BB2-453E-900A-87BF324D5F75'
}
if(localStorage.UserCode){
  Vue.prototype.$ZcPublic.needLogin=true
}
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>',
  created() {
    let me = this;
    me.$ZcPublic.Server =zcServer.ServerUrl
    if(me.$ZcPublic.zcServer.IsDebug){
      me.$ZcPublic.Domain = "http://" + window.location.host + "/vue-result-lib/";
    }else {
      me.$ZcPublic.Server="http://" + window.location.host + "/";
      me.$ZcPublic.Domain = "http://" + window.location.host + "/vue-result-lib/vue-result-lib/";
    }


  }
})
router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    window.document.title = to.meta.title;
    next();
  }
  else {
    next();
  }
})
